package org.wisdom.ac.service;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.wisdom.ac.apis.ResourceController;
import org.wisdom.ac.dto.ResourceDto;

import java.time.Duration;
import java.util.*;

/**
 * @author zhangzhiyan
 * @date 2021/08/26 09:21
 **/

@Slf4j
public class AcRunListener implements SpringApplicationRunListener {

    @SuppressWarnings("unused")
    public AcRunListener(SpringApplication sa, String[] args) {

    }

    @Override
    public void starting(ConfigurableBootstrapContext bootstrapContext) {
        log.debug("服务启动starting...");
    }

    @Override
    public void environmentPrepared(ConfigurableBootstrapContext bootstrapContext,
        ConfigurableEnvironment environment) {
        log.debug("服务启动environmentPrepared...");
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        log.debug("服务启动contextPrepared...");
    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {
        log.debug("服务启动contextLoaded...");
    }

    @Override
    public void started(ConfigurableApplicationContext context, Duration timeTaken) {

        log.debug("服务启动started...{}",timeTaken.getSeconds());
    }

    @Override
    public void ready(ConfigurableApplicationContext context, Duration timeTaken) {
        log.debug("服务启动ready...");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        log.debug("服务启动failed...");
    }
}
